<%-- 
    Document   : showAdmin
    Created on : Aug 20, 2012, 2:08:01 PM
    Author     : HungDQ
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>

<div class="section table_section">
    <!--[if !IE]>start title wrapper<![endif]-->
    <div class="title_wrapper">
        <h2>Account Management Members</h2>
        <span class="title_wrapper_left"></span>
        <span class="title_wrapper_right"></span>
    </div>
    <!--[if !IE]>end title wrapper<![endif]-->

    <!--[if !IE]>start section content<![endif]-->
    <div class="section_content">
        <!--[if !IE]>start section content top<![endif]-->
        <div class="sct">
            <div class="sct_left">
                <div class="sct_right">
                    <div class="sct_left">
                        <div class="sct_right">
                            <form action="#">
                            <fieldset>
                            <!--[if !IE]>start table_wrapper<![endif]-->
                            <div class="table_wrapper">
                                <div class="table_wrapper_inner">
                                <div id="container">
                                    <!------------------------------------------------->
                                    <!------------------------------------------------->
                                    <!------------------------------------------------->

                                    <%
                                    Object message = request.getSession().getAttribute("MESS");
                                    if(message != null && !message.equals(""))
                                    {
                                        out.println("<script>alert(\""+message.toString()+"\");</script>");
                                        request.getSession().removeAttribute("MESS");
                                    }
                                    %>

                                    <%
                                    Object objAppCon = application.getAttribute("APP_CONN");
                                    java.util.ArrayList<org.nvdung.bean.Member> al;
                                    if(objAppCon != null)
                                    {
                                        java.sql.Connection connection = (java.sql.Connection)objAppCon;
                                        org.nvdung.db.SqlMember sqlCus = new org.nvdung.db.SqlMember(connection);
                                        al = sqlCus.getAllMember();
                                        if(al.size() > 0)
                                        {
                                    %>
                                    <div id="demo">
                                        <table cellpadding="0" width="100%" cellspacing="0" border="0" class="display" id="nvdung">
                                            <thead>
                                                <tr>
                                                    <th width="10%" align="center">ID</th>
                                                    <th width="15%" align="center">Username</th>
                                                    <th width="35%" align="center">Full Name</th>
                                                    <th width="15%" align="center">Telephone</th>
                                                    <th width="10%" align="center">Role</th>
                                                    <th width="10%" align="center">Status</th>
                                                    <th width="5%" align="center">Action</th>
                                                </tr>
                                            </thead>
                                            <%
                                            for(int i=0;i<al.size();i++)
                                            {
                                                org.nvdung.bean.Member cus = al.get(i);
                                            %>
                                                <tr>
                                                    <td><%=cus.getMemberID() %></td>
                                                    <td><a class="product_name" href="?option=member&action=edit&id=<%=cus.getMemberID() %>"><%=cus.getUsername() %></a></td>
                                                    <td><%=cus.getFullName() %></td>
                                                    <td><%=cus.getTelephone() %></td>
                                                    <td><a href="?option=role&action=edit&id=<%=cus.getRoleID() %>"><%=cus.getRoleName() %></a></td>
                                                    <td>
                                                        <%
                                                        boolean isActive = cus.isStatus();
                                                        if(isActive) {
                                                            %> <span class="nvdung_active">Available</span><%
                                                        } else {
                                                           %> <span class="nvdung_inactive">Inactive</span><%
                                                        }
                                                        %>
                                                    </td>
                                                    <td align="center">
                                                        <div class="actions_menu">
                                                            <ul>
                                                                <li><a class="edit" href="?option=member&action=edit&id=<%=cus.getMemberID() %>">Edit</a></li>
                                                                <li><a class="delete" onclick="return confirm('Do you want delete member with id = <%=cus.getMemberID() %> ?');" href="javascript: gotoDelete('<%=cus.getMemberID()%>');">Delete</a></li>
                                                            </ul>
                                                        </div>
                                                    </td>
                                                </tr>
                                            <%
                                            }
                                            %>
                                        </table>
                                    </div>
                                    <%
                                        }
                                    }
                                    %>
                                    <div class="table_menu">
                                        <ul class="left">
                                            <li><a href="?option=member&action=add" class="button check_all"><span><span>Manager Member</span></span></a></li>
                                        </ul>
                                        <ul class="right">
                                            <li><a href="?option=member&action=add" class="button add_new"><span><span>ADD NEW ACCOUNT</span></span></a></li>
                                        </ul>
                                    </div>
                                    <!------------------------------------------------->
                                    <!------------------------------------------------->
                                    <!------------------------------------------------->
                                </div>
                                </div>
                            </div>
                            <!--[if !IE]>end table_wrapper<![endif]-->
                            </fieldset>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!--[if !IE]>end section content top<![endif]-->
        <!--[if !IE]>start section content bottom<![endif]-->
        <span class="scb"><span class="scb_left"></span><span class="scb_right"></span></span>
        <!--[if !IE]>end section content bottom<![endif]-->
    </div>
    <!--[if !IE]>end section content<![endif]-->
</div>

<form name="frmDelete" method="get" action="../nvdung/member/delete">
    <input type="hidden" name="id" value="" />
</form>
<script>
    function gotoDelete(deleteValue) {
        document.frmDelete.id.value = deleteValue;
        document.frmDelete.submit();
    }
</script>